'use strict';

const Controller = require('egg').Controller;

class UploadController extends Controller {

  async getFileToken() {
    const { ctx,app } = this;
    let  filesInfo=[];

    let kind=ctx.query.file_kind||1;//1:pic,2:视频3:音频4：文档
    let count=ctx.query.count||1;
     console.log('count',count)

    for(let i=0;i<count;i++){
      let fileid=new Date().getTime()+'00'+i;//时间戳作为id
      let uploadToken=app.exeQiniu.getToken();
      filesInfo.push({'ticket':uploadToken,'file_id':fileid});
    }
    ctx.body = filesInfo;
  }
}

module.exports = UploadController;
